<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .border {
      border: 1px solid red;
    }
  </style>
  <!-- 1导包 -->
  <script src="./lib/jquery-1.12.4.js"></script>
  <script src="./lib/template-web.js"></script>
</head>
<body>
  <script type="text/html" id="template">
    <ul>
      <!-- each表示循环渲染  渲染是的是brand这个数组， brand是通过
      下方的tempalte传递进来的
      -->
      {{each brand}}
          <li>
             <a href="">{{$value.title}}</a>
             <!-- <p>{{$value.text}}</p> -->
              <ul>
                  {{each $value.text}}
                     <li class="border">{{$value}}</li>
                  {{/each}}
                  
              </ul>
          </li>
      {{/each}}
   </ul>
  
  </script>


  <script>
     $.ajax({
       type:"get",
       url:"http://git.coding-future.com:3010/list/shopsort",
       data:{},
       dataType:"json",
       success (res) {
        // console.log(res);
        //  const {data :{brand}} = res;
         const {  data } = res;
        //  解构赋值
         console.log(data);
         const htmlStr =  template("template",data)

         $("body").html(htmlStr)
       },
       error () {

       }
     }) 
  </script>
</body>
</html>